#
#
#

include Makefile.conf

OBJS=easygui.o widgets.o context.o glob_methods.o dnd.o \
	widgets/button.o \
	widgets/checkbutton.o \
	widgets/clist.o \
	widgets/cols.o \
	widgets/combo.o \
	widgets/drawingarea.o \
	widgets/entry.o \
	widgets/eqcols.o \
	widgets/eqrows.o \
	widgets/eventbox.o \
	widgets/frame.o \
	widgets/label.o \
	widgets/menu.o \
	widgets/menubar.o \
	widgets/optmenu.o \
	widgets/radiobutton.o \
	widgets/rows.o \
	widgets/scrolledwindow.o \
	widgets/separator.o \
	widgets/tabs.o \
	widgets/tclist.o \
	widgets/toolbar.o \
	widgets/window.o

all: mk_widgets $(OBJS)

test:	easygui.test

easygui.test:	easygui.c easygui.h widgets.o 
	@$(CC) -DTEST_CLASS $(CFLAGS) -o easygui.test -g -Wall easygui.c widgets.o $(LIBS)

mk_widgets:
	@cd widgets; make

%.o:	%.c %.h
	@echo "Building: $@"
	@$(CC) -c $(CFLAGS) $< -o $@

lib:	libafc_easygui.so.1.0.0

libafc_easygui.so.1.0.0: easygui.o widgets.o
	@$(CC) $(LIBFLAGS) -Wl,-soname,libafc_easygui.so.1 -o libafc_easygui.so.1.0.0 $(OBJS)

install:	libafc_easygui.so.1.0.0 includes
	@echo "   ... shared library"
	@$(LN) libafc_easygui.so.1 libafc_easygui.so 
	@$(MV) libafc_easygui.so* $(LIBDIR)
	ldconfig

includes:
	@echo "Copying header files for EasyGUI"
	@if [ -d $(INCDIR)/afc/easygui ]; then echo "Copying Main Headers..."; else mkdir -p $(INCDIR)/afc/easygui; fi 
	@$(CP) *.h $(INCDIR)/afc/easygui
	@if [ -d $(INCDIR)/afc/easygui/widgets ]; then echo "Copying Widgets Headers files..."; else mkdir -p $(INCDIR)/afc/easygui/widgets; fi 
	@$(CP) widgets/*.h $(INCDIR)/afc/easygui/widgets

clean:
	@$(RM) -f ./*.o
	@$(RM) -f easygui.test 2>/dev/null
	@$(RM) -f libeasygui*
	@cd widgets; make clean;
